package o;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.graphics.drawable.Drawable.ConstantState;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

class ge extends Drawable implements Callback, gd, gf {
    static final Mode ˏ = Mode.SRC_IN;
    private boolean ʻ;
    private boolean ʽ;
    private Mode ˊ;
    gl ˋ;
    Drawable ˎ;
    private int ॱ;

    ge(@NonNull gl glVar, @Nullable Resources resources) {
        this.ˋ = glVar;
        ॱ(resources);
    }

    ge(@Nullable Drawable drawable) {
        this.ˋ = ॱ();
        ॱ(drawable);
    }

    private void ॱ(@Nullable Resources resources) {
        if (this.ˋ != null && this.ˋ.ˎ != null) {
            ॱ(this.ˋ.ˎ.newDrawable(resources));
        }
    }

    public void jumpToCurrentState() {
        this.ˎ.jumpToCurrentState();
    }

    public void draw(@NonNull Canvas canvas) {
        this.ˎ.draw(canvas);
    }

    protected void onBoundsChange(Rect rect) {
        if (this.ˎ != null) {
            this.ˎ.setBounds(rect);
        }
    }

    public void setChangingConfigurations(int i) {
        this.ˎ.setChangingConfigurations(i);
    }

    public int getChangingConfigurations() {
        return ((this.ˋ != null ? this.ˋ.getChangingConfigurations() : 0) | super.getChangingConfigurations()) | this.ˎ.getChangingConfigurations();
    }

    public void setDither(boolean z) {
        this.ˎ.setDither(z);
    }

    public void setFilterBitmap(boolean z) {
        this.ˎ.setFilterBitmap(z);
    }

    public void setAlpha(int i) {
        this.ˎ.setAlpha(i);
    }

    public void setColorFilter(ColorFilter colorFilter) {
        this.ˎ.setColorFilter(colorFilter);
    }

    public boolean isStateful() {
        ColorStateList colorStateList = (!ˎ() || this.ˋ == null) ? null : this.ˋ.ॱ;
        return (colorStateList != null && colorStateList.isStateful()) || this.ˎ.isStateful();
    }

    public boolean setState(@NonNull int[] iArr) {
        return ˋ(iArr) || this.ˎ.setState(iArr);
    }

    @NonNull
    public int[] getState() {
        return this.ˎ.getState();
    }

    @NonNull
    public Drawable getCurrent() {
        return this.ˎ.getCurrent();
    }

    public boolean setVisible(boolean z, boolean z2) {
        return super.setVisible(z, z2) || this.ˎ.setVisible(z, z2);
    }

    public int getOpacity() {
        return this.ˎ.getOpacity();
    }

    public Region getTransparentRegion() {
        return this.ˎ.getTransparentRegion();
    }

    public int getIntrinsicWidth() {
        return this.ˎ.getIntrinsicWidth();
    }

    public int getIntrinsicHeight() {
        return this.ˎ.getIntrinsicHeight();
    }

    public int getMinimumWidth() {
        return this.ˎ.getMinimumWidth();
    }

    public int getMinimumHeight() {
        return this.ˎ.getMinimumHeight();
    }

    public boolean getPadding(@NonNull Rect rect) {
        return this.ˎ.getPadding(rect);
    }

    @RequiresApi(19)
    public void setAutoMirrored(boolean z) {
        this.ˎ.setAutoMirrored(z);
    }

    @RequiresApi(19)
    public boolean isAutoMirrored() {
        return this.ˎ.isAutoMirrored();
    }

    @Nullable
    public ConstantState getConstantState() {
        if (this.ˋ == null || !this.ˋ.ॱ()) {
            return null;
        }
        this.ˋ.ˋ = getChangingConfigurations();
        return this.ˋ;
    }

    @NonNull
    public Drawable mutate() {
        if (!this.ʻ && super.mutate() == this) {
            this.ˋ = ॱ();
            if (this.ˎ != null) {
                this.ˎ.mutate();
            }
            if (this.ˋ != null) {
                this.ˋ.ˎ = this.ˎ != null ? this.ˎ.getConstantState() : null;
            }
            this.ʻ = true;
        }
        return this;
    }

    @NonNull
    private gl ॱ() {
        return new gl(this.ˋ);
    }

    public void invalidateDrawable(@NonNull Drawable drawable) {
        invalidateSelf();
    }

    public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long j) {
        scheduleSelf(runnable, j);
    }

    public void unscheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable) {
        unscheduleSelf(runnable);
    }

    protected boolean onLevelChange(int i) {
        return this.ˎ.setLevel(i);
    }

    public void setTint(int i) {
        setTintList(ColorStateList.valueOf(i));
    }

    public void setTintList(ColorStateList colorStateList) {
        this.ˋ.ॱ = colorStateList;
        ˋ(getState());
    }

    public void setTintMode(@NonNull Mode mode) {
        this.ˋ.ˊ = mode;
        ˋ(getState());
    }

    private boolean ˋ(int[] iArr) {
        if (!ˎ()) {
            return false;
        }
        ColorStateList colorStateList = this.ˋ.ॱ;
        Mode mode = this.ˋ.ˊ;
        if (colorStateList == null || mode == null) {
            this.ʽ = false;
            clearColorFilter();
            return false;
        }
        int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
        if (this.ʽ && colorForState == this.ॱ && mode == this.ˊ) {
            return false;
        }
        setColorFilter(colorForState, mode);
        this.ॱ = colorForState;
        this.ˊ = mode;
        this.ʽ = true;
        return true;
    }

    public final Drawable ˏ() {
        return this.ˎ;
    }

    public final void ॱ(Drawable drawable) {
        if (this.ˎ != null) {
            this.ˎ.setCallback(null);
        }
        this.ˎ = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
            setVisible(drawable.isVisible(), true);
            setState(drawable.getState());
            setLevel(drawable.getLevel());
            setBounds(drawable.getBounds());
            if (this.ˋ != null) {
                this.ˋ.ˎ = drawable.getConstantState();
            }
        }
        invalidateSelf();
    }

    protected boolean ˎ() {
        return true;
    }
}
